<?php
    include 'conn.inc.php';
    $sql = "select id, bookname, publisher, author, price, pic, detail from books where id={$_GET['id']}";
    $result = mysql_query($sql);
    if($result && mysql_num_rows($result) > 0){
        list($id,$bookname,$publisher,$author,$price,$pic,$detail) = mysql_fetch_row($result);  
    }else{
        die("<div id='right2'>没有找到需要修改的图书！</div>");
    }
    mysql_free_result($result);
    mysql_close($link);
?>
<h3>修改图书：</h3>
<form action="index.php?action=update" method="post" enctype="multipart/form-data">
    <input type="hidden" name="id" value="<?php echo $id?>"/>
    图书名称：<input type="text" name="bookname" value="<?php echo $bookname?>" /><br/>
    出版商名：<input type="text" name="publisher" value="<?php echo $publisher?>" /><br/>
    图书作者：<input type="text" name="author" value="<?php echo $author?>" /><br/>
    图书价格：<input type="text" name="price" value="<?php echo $price?>" /><br/>
    <input type="hidden" name="MAX_FILE_SIZE"value="1000000">
    
    <input type="hidden" name="picname"value="<?php echo $pic ?>"/>
    图书图片：<input type="file" name="pic" value="<?php echo $pic?>" /><br/>
    图书介绍：<textarea name="detail" cols="30" rows="5"><?php echo $detail ?></textarea><br/>
　　　　　<input type="submit" name="add" value="修改图书">
</form>


